using System;
using System.Collections.Generic;
using System.Text;
using ClientGUI.Modules.Drawing;
using System.Xml;

using System.Drawing;

namespace ClientGUI
{
    /// <summary>
    /// Totally transparent 
    /// </summary>
	class Blank: Module
	{
        int blank_height;
        Color my_color;
        bool am_colored = false;

        /// <param name="host">the display</param>
        /// <param name="parent">the module's parent</param>
        /// <param name="fade">the color to give instead of blank</param>
        public Blank(DisplayDocument host, Module parent, Color fade): this(host, parent)
        {
            my_color = fade;
            am_colored = true;
        }


        /// <param name="host">the display</param>
        /// <param name="parent">the module's parent</param>
		public Blank(DisplayDocument host, Module parent)
			: base(null, parent, host, null)
		{

		}

        /// <summary>
        /// The height of this module, overridden to enforce 
        /// its given height.
        /// </summary>
        public override int Height
        {
            get
            {
                return blank_height;
            }
            set
            {
                base.Height = blank_height;
            }
        }

        /// <summary>
        /// The space routine. Overridden to enforce the 
        /// height.
        /// </summary>
        public override void Space(int width)
        {
            base.Space(width);
            Height = blank_height;
        }

        /// <summary>
        /// The place where this module's height is set.
        /// This height will be enforced no matter what...
        /// </summary>
        public void SetHeight(int h)
        {
            blank_height = h;
            Height = h; //don't mess, this works!
            blank_height = my_height = h;
        }

        public override DisplayArea GetDisplayArea()
        {
            if (!am_colored)
                return new BlankDisplayArea();
            else
            {
                return new RectangleDisplayArea(my_color,
                    new Rectangle(0, 0, my_width, my_height), new Pen(my_color), new Pen(my_color),
                    new RectangleVisible(true, true, true, true),
                    new RectangleVisible(true, true, true, true));
            }
        }

	}
}
